import request from '@/utils/request'

/**
 * 查询全部类目
 * @param {Object} query
 */
export function listCategory(query) {
  return request({
    url: '/ygAdminCategory/category',
    method: 'get',
    params: query
  })
}

/**
 * 查询一级类目
 */
export function listCatL1() {
  return request({
    url: '/ygAdminCategory/category/l1',
    method: 'get'
  })
}

/**
 * 查询二级类目
 */
export function listCatL2() {
  return request({
    url: '/ygAdminCategory/category/l2',
    method: 'get'
  })
}

/**
 * 新增类目
 * @param {Object} data
 */
export function createCategory(data) {
  return request({
    url: '/ygAdminCategory/creationCategory',
    method: 'post',
    data
  })
}

export function readCategory(data) {
  return request({
    url: '/category/read',
    method: 'get',
    data
  })
}

export function updateCategory(data) {
  return request({
    url: '/ygAdminCategory/updateCategory',
    method: 'post',
    data
  })
}

export function deleteCategory(data) {
  return request({
    url: '/ygAdminCategory/deleteCategory',
    method: 'post',
    data
  })
}
